package com.sy.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sy.dto.OrdersPageQueryDTO;
import com.sy.mapper.OrdersMapper;
import com.sy.pojo.Orders;
import com.sy.result.PageResult;
import com.sy.service.OrdersService;
import com.sy.vo.OrdersVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {
    @Autowired
    private OrdersMapper ordersMapper;

    @Override
    public PageResult findAll(OrdersPageQueryDTO ordersPageQueryDTO) {
        Page<OrdersVo> page=new Page<>(ordersPageQueryDTO.getPage(),ordersPageQueryDTO.getPageSize());

        page=ordersMapper.findAll(page,ordersPageQueryDTO.getName(),ordersPageQueryDTO.getPayStatus());

        return new PageResult(page.getTotal(),page.getRecords());
    }
}
